package com.ifp.core.connector;

import com.ifp.gateway.formatter.IFormatter;
import com.ifp.opengate.boot.utils.SnowFlake;

/**
 * @Classname AbstractConnector
 * @Description TODO
 * @Date 2019/7/8 19:10
 * @Created by zzh
 *          <p>
 *          zhuzh@belink.com
 *          </p>
 * @Version 1.0
 */
public abstract class AbstractConnector<T, V> {

    private String ip;

    private String port;

    private String usname;

    private String passwd;

    private IFormatter requestFormatter;

    private IFormatter responseFormatter;

    private String beanId;

    private String beanName;

    protected static final SnowFlake SNOWFLAKE = new SnowFlake(2, 3);

    public String getBeanName() {
        return beanName;
    }

    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    public abstract T sendAndReceive(String actionName, String path, V v) throws Exception;

    /**
     * 初始化Connector
     */
    public abstract void initConnector();

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getPort() {
        return port;
    }

    public void setPort(String port) {
        this.port = port;
    }

    public String getUsname() {
        return usname;
    }

    public void setUsname(String usname) {
        this.usname = usname;
    }

    public String getPasswd() {
        return passwd;
    }

    public void setPasswd(String passwd) {
        this.passwd = passwd;
    }

    public IFormatter getRequestFormatter() {
        return requestFormatter;
    }

    public void setRequestFormatter(IFormatter requestFormatter) {
        this.requestFormatter = requestFormatter;
    }

    public IFormatter getResponseFormatter() {
        return responseFormatter;
    }

    public void setResponseFormatter(IFormatter responseFormatter) {
        this.responseFormatter = responseFormatter;
    }

    public String getBeanId() {
        return beanId;
    }

    public void setBeanId(String beanId) {
        this.beanId = beanId;
    }

}
